<?php
namespace app\index\controller;

use think\Controller;

class League extends Common
{
    public function _initialize()
    {
        parent::_initialize();
        $this->assign('active', '招商加盟');
        $url = input('param.id', 0) > 0 ? '/league/' . input('param.id', 0) : '/league';
        $this->assign('nav_image', get_nav_img($url));
    }

    // 招商加盟页面
    public function index() {
        $id = input('param.id', 0);

        $where['a.cate_id'] = 9;
        if ($id > 0) {
            $where['a.id'] = $id;
        }
        // 获取公司介绍
        $league = db('article')
            ->alias('a')
            ->field('a.*, ac.content')
            ->join("osl_article_content ac", "ac.article_id = a.id", "LEFT")
            ->where($where)
            ->find();
        $this->assign('league', $league);

        $article = db('article')->where('cate_id', 9)->select();
        $this->assign('article', $article);

        return view();
    }
}
